﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>加油</title>
    <link href="/CSS/Module/public.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/Module/QC1.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/Module/QD3.css" rel="stylesheet" type="text/css" />

    <script src="/JS/jquery.js" type="text/javascript"></script>

    <script src="/JS/jyAjax.js" type="text/javascript"></script>

    <script src="/JS/module.js" type="text/javascript"></script>

    <link href="/JS/MsgBox/moonbox.css" rel="stylesheet" type="text/css" />

    <script src="/JS/MsgBox/moonbox.js" type="text/javascript"></script>    
<script type="text/javascript" language="javascript">
  
    function ValidateClub(){
        var count=$("#selCountHidden").val();
        var type=$("#mTypeHidden").val();        
        if(count<2){
            if(type!="Car"){
                $.moonbox.warning('请选择一个俱乐部然后进行比赛！');
            }else{
                $.moonbox.warning('请选择至少一个俱乐部然后进行比赛！');
            }            
            return false;
        }        
        return true;
    }
    
    $(function(){
        $("#clubListDiv input[type=checkbox]").click(function(){        
            var count=parseInt($("#selCountHidden").val());
            var idItems=$("#selClubHidden").val();
            var id=this.value;
            if(this.checked){
                count=count+1;
                if(idItems==""){
                    idItems=id;
                }else{
                    idItems=idItems+"_"+id;
                }
            }else{
                count=count-1;
                idItems=idItems.replace("_"+id,"");                
            }
            $("#selCountHidden").val(count);
            $("#selClubHidden").val(idItems);                                
            var chks = $("#clubListDiv input[type=checkbox]");
            var maxCount=$("#maxCountHidden").val();
            if(count>=maxCount){                
              for(var i=0;i<chks.length;i++){                                        
                  if(!chks[i].checked){
                      chks[i].disabled="disabled"; 
                  }else{
                      chks[i].disabled=""; 
                  } 
              }                                      
           }else{
               for(var j=0;j<chks.length;j++){                    
                   chks[j].disabled="";  
               }                   
           }	
            
        })
    })
    function SetAction(){
        clubForm.action="/Module/Venues/VenuesRaceManage.ashx?Type=Quit&VenuesId=$ModuleId$";
    }
    </script>
</head>
<body>
    $Header$ $MainMenu$
    <div class="Middle">
        $LeftMenu$
        <div class="Content">
            $ContentClub$
            <div class="MiddleTitle">
                <ul>
                    <input type="hidden" id="venuesHidden" name="venuesHidden" value="$ModuleId$" />
                    <li class="FontGreenB">$VenuesName$：</li>
                    <li class="FontRedB">场地加油</li>
                </ul>
            </div>
            <div id="objectDiv" class="QC1Play">
                </div>
            <div id="raceDiv" class="QD3_2GameSet">
                $Div0$
                <div class="QD3_2GameSetVs">
                    <img src="/images/Module/QD3_2vs.gif" alt="vs" $Style$ /></div>
                $Div1$
            </div>
            $Script$
            <div id="clubListDiv" class="QC1PlayerLine2" style="$clubliststyle$">
                    $ClubList$
                </div>
                <div class="QC1PlayerLine3" style="$clubliststyle$">
                    <ul class="QC1PlayerLine3Left">
                        <li>
                            <form id="clubForm" action="/Module/Venues/VenuesRaceManage.ashx?Type=StartRace&VenuesId=$ModuleId$"
                            method="post">
                            <input type="submit" value=" " class="InviteBtn" onclick="if(!ValidateClub()){return false;}" />
                            <input type="hidden" id="selClubHidden" name="selClubHidden" value="$ClubId$" />
                            <input type="hidden" id="selCountHidden" name="selCountHidden" value="1" />
                            <input type="hidden" id="maxCountHidden" name="maxCountHidden" value="$MaxCount$" />
                            <input type="hidden" id="mTypeHidden" name="mTypeHidden" value="$MType$" />
                            <input type="submit" class="BtnBlueBg" value="退出赛场" onclick="SetAction()"/>                            
                            </form>
                        </li>
                    </ul>                    
                </div>
        </div>
        $InterValScript$
        
                
    </div>
    $Footer$
</body>
</html>
